#include <iostream.h>
#include <pthread.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <semaphore.h>
#include <signal.h>
	  
void * thread_function ( void * arg )
{
	cout<< "In thread Func: Process ID = " << (int)getpid() << endl;
	while(1)
	{
		sleep(2);
		cout<< "SubThread is running" << endl;
	}
	
	return NULL;
}

int main()
{
	pthread_t tid;
	
	cout<< "In main thread, Process ID= " << (int)getpid() << endl;
	
	pthread_create(&tid, NULL, thread_function, NULL);
	sleep(5);
	pthread_kill ( tid, 9 );
	cout<< "Have sent out kill signal" << endl;

	while(1);

	return 0;
}
